package com.rgs.base.core.system;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum AsyncTaskTypeEnum {
//0,基础信息，1.考勤管理，2.消费管理，3.访客管理, 7.社区业务.......


    //基础信息相关0
    ACCOUNT_DOWNLOAD(1001, "账户信息下载",
            Collections.singletonList(0)),

    SCENE_EXPORT(1002, "场景导出",
            Arrays.asList(0, 1, 2, 3, 4, 5)
    ),

    SCENE_ATTENDANCE_EXPORT(10020, "考勤场景导出",
            Collections.singletonList(1)),
    SCENE_ENTRANCE_EXPORT(10021, "门禁场景导出",
            Collections.singletonList(2)),


    DEVICE_RECORD_IMPORT(1003, "设备记录导入",
            Collections.singletonList(0)),

    ACCOUNT_INFO_IMPORT(1004, "人员信息导入",
            Collections.singletonList(0)),

    ACCOUNT_INFO_EXPORT(1005, "人员信息导出",
            Collections.singletonList(0)),

    FACE_REGISTER_IMPORT(1006, "人脸批量注册",
            Collections.singletonList(0)),

    BLACK_ACCOUNT_EXPORT(1007, "黑名单信息",
            Collections.singletonList(0)),
    DEVICE_STATE_EXPORT(1008, "设备状态导出",
            Collections.singletonList(0)),

    RECORD_DATA_EXPORT(1009, "识别信息记录导出",
            Collections.singletonList(0)),


    //考勤管理相关1
    ATTENDANCE_DATA_EXPORT(2001, "考勤明细",
            Collections.singletonList(1)),

    //消费相关2

    CONSUME_DETAIL_EXPORT(3001, "消费明细",
            Collections.singletonList(2)),

    //访客管理3
    ID_CARD_DATA_EXPORT(4001, "认证比对明细",
            Collections.singletonList(3)),
    VISIT_DATA_EXPORT(4002, "访客明细",
            Collections.singletonList(3)),

// 7.社区业务

    BUILDING_INFO_IMPORT(7001, "楼栋信息导入",
            Collections.singletonList(7)),
    BUILDING_INFO_EXPORT(7002, "楼栋信息导出",
            Collections.singletonList(7)),

    UNIT_INFO_IMPORT(7003, "单元楼信息导入",
            Collections.singletonList(7)),
    UNIT_INFO_EXPORT(7004, "单元楼信息导出",
            Collections.singletonList(7)),

    PERSONNEL_INFO_IMPORT(7005, "人员信息导入",
            Collections.singletonList(7)),
    PERSONNEL_INFO_EXPORT(7006, "人员信息导出",
            Collections.singletonList(7)),

    HOUSE_INFO_IMPORT(7007, "房屋信息导入",
            Collections.singletonList(7)),
    HOUSE_INFO_EXPORT(7008, "房屋信息导出",
            Collections.singletonList(7)),

    PROPERTY_INFO_IMPORT(7009, "人员（物业）信息导入",
            Collections.singletonList(7)),
    RESIDENT_INFO_IMPORT(7010, "人员（住户）信息导入",
            Collections.singletonList(7)),

    ACCESS_RECORD_EXPORT(7011, "人员通行记录导出",
            Collections.singletonList(7)),


    ;
    private int code;
    private String taskName;
    private List<Integer> topicTypeList;


    final static List<AsyncTaskTypeEnum> ASYNC_TASK_TYPE_MAP;


    public static List<AsyncTaskTypeEnum> listByTypeList(Integer topicType) {
        return ASYNC_TASK_TYPE_MAP.stream()
                .filter(q -> q.getTopicTypeList().contains(topicType))
                .collect(Collectors.toList());
    }

    static {
        ASYNC_TASK_TYPE_MAP = Arrays.asList(values());
    }

}

